package com.ep.demo;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;

public class DBUtils {
	public static Session getSession(){
		Configuration config=new Configuration().configure();
		StandardServiceRegistryBuilder builder=new StandardServiceRegistryBuilder().applySettings(config.getProperties());
		ServiceRegistry sr=builder.build();
		SessionFactory sf = config.buildSessionFactory(sr);
		return sf.openSession();
	}
}
